<template>
  <div class="leftNav">
    <ul @click="addNavClass" id="menu">
      <li>
        <router-link :to="{path: '/'}">
          <i class="icon iconfont icon-shouye3"></i>
          <p>收银</p>
        </router-link>
      </li>
      <li>
        <router-link :to="{path: '/house'}">
          <i class="icon iconfont icon-shouye1"></i>
          <p>店铺</p>
        </router-link>
      </li>
      <li>
        <router-link :to="{path: '/goods'}">
          <i class="icon iconfont icon-shouye"></i>
          <p>商品</p>
        </router-link>
      </li>
      <li>
        <router-link :to="{path: '/member'}">
          <i class="icon iconfont icon-icon"></i>
          <p>会员</p>
        </router-link>
      </li>
      <li>
        <router-link :to="{path: '/statistics'}">
          <i class="icon iconfont icon-icon1"></i>
          <p>统计</p>
        </router-link>
      </li>
      <li>
        <router-link :to="{path: '/setting'}">
          <i class="icon iconfont icon-shouye2"></i>
          <p>设置</p>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: 'left-nav',
    data() {
      return {

      }
    },
    methods: {
      addNavClass(event) {
        // let e = event || window.event;
        // let [target,actv] = [e.target || e.srcElement,'actv'];
        // let temp = document.getElementById('menu').getElementsByTagName('li');
        //
        // if (target.nodeName.toLowerCase() !== 'li') {
        //   Array.from(temp).forEach(function (val) {
        //     val.classList.remove(actv);
        //   });
        //   target.parentNode.parentNode.classList.add(actv);
        // }
      }
    },
    mounted(){

    },
    computed: {

    }
  };
</script>

<style>
  .leftNav {
    float: left;
    height: 100vh;
    background-color: aqua;
  }

  .leftNav a {
    display: block;
    padding: 10px 20px;
    border-bottom: 1px solid #FFF;
  }

  .actv {
    background-color: red;
  }

  .icon {
    font-size: 30px;
  }
</style>
